package org.atguigu.gmall.realtime.function;

import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;
import org.atguigu.gmall.realtime.util.AtguiguUtil;

import java.util.Set;

/**
 * Project:gmallRealTime
 * Package:org.atguigu.gmall.realtime.function
 * Author: ZengHaiFeng
 * CreateTime:2023/4/27 16:57:32
 * Description: Todo split keyword
 * Version：1.0
 */
@FunctionHint(output = @DataTypeHint("Row<keyword string>"))
public class KwSplit extends TableFunction<Row> {
    public void eval(String s){
        // get all complete split result
        Set<String> kws = AtguiguUtil.ikSplit(s);
        for (String kw : kws) {
            collect(Row.of(kw));
        }

    }
}
